package com.scalar.chiptrack.commons.forms;

import com.scalar.chiptrack.ChipTrackActionForm;
import com.scalar.chiptrack.commons.bean.IResultBean;
import com.scalar.chiptrack.commons.bean.TableMetaDataBean;
import com.scalar.chiptrack.commons.bean.IPaginator;

import java.util.ArrayList;

/**
 * User: Ganesh
 * Date: Apr 29, 2008
 * Time: 11:40:17 AM
 */
public class BaseResultActionForm extends ChipTrackActionForm {
    protected String _scrollAction = "";
//  protected String _currentPageNo = "1";
    protected String _pageCount      ="0";
    protected String _currentPageNo = "1";
    protected IPaginator _paginator = null;
    protected ResultFormBean _resultBean=null;
    protected TableMetaDataBean _tableMetaDataBean = null;
    protected ArrayList _columnBeanList = null;
    protected String _subAction = "";
    protected IResultBean  pageResultBean=    null;
    protected String formName="";
    protected String pageName="";
    protected String reportType="";
    protected String sessionAttribute="";
    private String reportExportFormat;
    private ArrayList reportExportFormatList;


    public BaseResultActionForm(){
        _resultBean=new ResultFormBean();
        _tableMetaDataBean=new TableMetaDataBean();
    }


    public String getReportExportFormat() {
        return reportExportFormat;
    }

    public void setReportExportFormat(String reportExportFormat) {
        this.reportExportFormat = reportExportFormat;
    }

    public ArrayList getReportExportFormatList() {
        return reportExportFormatList;
    }

    public void setReportExportFormatList(ArrayList reportExportFormatList) {
        this.reportExportFormatList = reportExportFormatList;
    }

    public String getPageCount() {
        return _pageCount;
    }

    public void setPageCount(String pageCount) {
        this._pageCount = pageCount;
    }

    public String getScrollAction() {
        return _scrollAction;
    }

    public void setScrollAction(String scrollAction) {
        this._scrollAction = scrollAction;
    }

    public String getCurrentPageNo() {
        return _currentPageNo;
    }

    public void setCurrentPageNo(String currentPageNo) {
//        System.out.println("Current page no....."+currentPageNo);
        this._currentPageNo = currentPageNo;
    }

    public IPaginator getPaginator() {
        return _paginator;
    }

    public void setPaginator(IPaginator paginator) {
        this._paginator = paginator;
    }

    public ResultFormBean getResultBean() {
        return _resultBean;
    }

    public void setResultBean(ResultFormBean resultBean) {
        this._resultBean = resultBean;
    }

    public String getSubAction() {
        return _subAction;
    }

    public void setSubAction(String subAction) {
        this._subAction = subAction;
    }

    public TableMetaDataBean getTableMetaDataBean() {
        return _tableMetaDataBean;
    }

    public void setTableMetaDataBean(TableMetaDataBean tableMetaDataBean) {
        this._tableMetaDataBean = tableMetaDataBean;
    }

    public ArrayList getColumnBeanList() {
        return _columnBeanList;
    }

    public void setColumnBeanList(ArrayList columnBeanList) {
        this._columnBeanList = columnBeanList;
    }


    public String getFormName() {
        return formName;
    }

    public void setFormName(String formName) {
        this.formName = formName;
    }


    public IResultBean getPageResultBean() {
        return pageResultBean;
    }

    public void setPageResultBean(IResultBean pageResultBean) {
        this.pageResultBean = pageResultBean;
    }


    public String getPageName() {
        return pageName;
    }

    public void setPageName(String pageName) {
        this.pageName = pageName;
    }


    public String getReportType() {
        return reportType;
    }

    public void setReportType(String reportType) {
        this.reportType = reportType;
    }


    public String getSessionAttribute() {
        return sessionAttribute;
    }

    public void setSessionAttribute(String sessionAttribute) {
        this.sessionAttribute = sessionAttribute;
    }

    public ArrayList getPageNumbers()
    {
        int totalPages = 0;
        if (_paginator != null)
        {
            totalPages = _paginator.getNumberOfPages();
        }
        ArrayList list = new ArrayList();
        for (int i=1;i<=totalPages;i++)
        {
            list.add(String.valueOf(i));
        }
        return list;
    }
}
